package com.cskaoyan._05oop2._02inherit;

/**
 * @author Macro_Ray
 * @since 2024/3/11 23:34
 */
public class _02Inherit {
    public static void main(String[] args) {
        // 创建对象并调用方法
        Ragdoll ragdoll = new Ragdoll();
        ragdoll.eat();
        ragdoll.drink();
        ragdoll.catchMice();

        System.out.println("----------------");

        Husky husky = new Husky();
        husky.eat();
        husky.drink();
        husky.watchDoor();
        husky.demolition();
    }
}
class Animal2{
    public void eat(){
        System.out.println("吃饭");
    }
    public void drink(){
        System.out.println("喝水");
    }
}
class Cat2 extends Animal2{
    public void catchMice(){
        System.out.println("抓老鼠");
    }
}
class Dog2 extends Animal2{
    public void watchDoor(){
        System.out.println("看门");
    }
}

// 布偶
class Ragdoll extends Cat2{

}
// 狸花
class LiHua extends Cat2{

}
// 哈士奇
class Husky extends Dog2{
    public void demolition(){
        System.out.println("哈士奇拆家");
    }
}
// 泰迪
class Poodle extends Dog2{
    public void rub(){
        System.out.println("蹭蹭");
    }
}

